@extends('company.company')

@section('title','企业中心')
@section('rightcontainer')
<style>
.tab-row ul li {
    width: 19%;
    float: left;
    height: 50px;
    line-height: 50px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}
.tab-row ul li.first-icon{
	width: 5%;
}
</style>
<div class="col-xs-10" style="padding-right: 0;">
    <div class="tab-row bord-b font-16">
        <ul>
            <li class="first-icon"></li>
            <li><strong>职位名称</strong></li>
            <li><strong>招聘</strong></li>
            <li><strong>发布时间</strong></li>
            <li><strong>状态</strong></li>
            <li><strong>操作</strong></li>
        </ul>
    </div>
    @foreach ($jobs as $job)
        {{-- expr --}}
    <div class="tab-row bord-b">
        <ul>
            <li class="first-icon">
                <span class="fl">
    		      @if($job->status == 1 || $job->status == 3)
    		      <img alt="审核通过" title="审核通过" src="{{ asset('/images/reset/passed.png') }}">
    		      @elseif($job->status == 2)
    		      <img alt="审核不通过" title="职位内容不符合要求，审核不通过！" src="{{ asset('/images/reset/no_pass.png') }}">
    		      @elseif($job->status == 0)
    		      <img alt="待审核" title="审核中..." src="{{ asset('/images/reset/no_validate.png') }}">
    		      @endif
    		    </span>
            </li>
            <li title="{{$job->title}}" style="cursor: pointer">
            {{ str_limit($job->title,24) }}
            </li>
            <li>{{ $job->recruitment }}人</li>
            <li>{{ $job->published_at }}</li>
            <li>
                @if($job->status == 0)
                <span class="cursor-pointer color-13">职位审核中...</span>
                @elseif($job->status == 2)
                <span class="cursor-pointer color-4">审核不通过</span>
                @else
                <span class="cursor-pointer
                 @if($job->status == 1) color-4
                 @elseif ($job->status == 3) color-1
                 @endif padd-r-5" @if($job->status == 1) disabled @endif
                 onclick="changeStatus({{ $job->jobs_id }},1,this,'open')">开启</span>
                 |
                <span class="cursor-pointer
                @if($job->status == 3) color-4
                @elseif ($job->status == 1) color-13
                @endif padd-l-5" @if($job->status == 3) disabled @endif
                 onclick="changeStatus({{ $job->jobs_id }},3,this,'close')">关闭</span>
                 @endif
            </li>
            <li>
                <span class="cursor-pointer padd-r-5">简历</span>
                 |
                <span class="cursor-pointer padd-l-5">刷新</span>
                 |
                <span class="cursor-pointer padd-l-5">
                    <a href="/company/center/jobsmanage?id={{ $job->jobs_id }}">编辑</a></span>
            </li>
        </ul>
    </div>
    @endforeach
    <div>{!! $jobs->render() !!} </div>
</div>
<script type="text/javascript">

    // 头部菜单导航样式
    $(function() {
            $('#nav ul').find('li').attr('class', 'curr').removeClass('curr');
            $('#nav ul li').eq(3).attr('class', 'curr');
    });

    function changeStatus(jobs_id, status, obj,type)
    {
        $.ajax({
        'url':'/company/center/status',
        'type':'GET',
        'data':'jobs_id='+jobs_id+'&status='+status,
        error: function(request) {
          $('#'+id).html('<option value="0">没有更多分类</option>');
            },
        success: function(data){
          if(data.status == 'success'){
            location.reload();
          }else{
            $('#'+id).html('<option value="0">没有更多分类</option>');
          }
        },
      });
    }
</script>

@stop

<!--底部导航-->
@section('footer')
@parent
@stop

